home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 February
/
Macworld (1999-02).dmg
/
Cinema 4D GO demo
/
Gumption Plug-ins
/
Plug-ins
/
Freeware
/
DPI
/
DPI.COF
Wrap
Text File
|
1998-03-19
|
1KB
|
57 lines
// DPI
// calculate pixel resolution from DPI and paper size
// (c) Christian Losch
// 1998 Maxon Computer GmbH
struct Mem
{
var p_x,p_y;
var dpi;
};
var mem;
Function(doc)
{
var resx,resy;
var dlg = new (SimpleDialog);
dlg->SetTitle("DPI Conversion");
dlg->SetData(0,"Paper X (in)" ,FIELD_FLOAT ,0.0,1E6,mem->p_x);
dlg->SetData(1,"Paper Y (in)" ,FIELD_FLOAT ,0.0,1E6,mem->p_y);
dlg->SetData(2,"DPI" ,FIELD_INTEGER,1,10000,mem->dpi);
if (!dlg->DoDialog()) return;
mem->p_x = dlg->GetData(0);
mem->p_y = dlg->GetData(1);
mem->dpi = dlg->GetData(2);
resx = mem->p_x*mem->dpi;
resy = mem->p_y*mem->dpi;
if (resx>16384) resx = 16384.0;
if (resy>16384) resy = 16384.0;
if (resx*resy>800*600*10)
{
var text=new(string,255);
text = stradd("Warning ",tostring(resx,".0f"),"x",tostring(resy,".0f")," is|",tostring(resx*resy/480000,".1f")," times slower|than 800x600|Do you want to continue?");
if (TextDialog(text,DLG_OKCANCEL+DLG_ICONQUESTION)!=DLG_R_OK) return;
}
doc->SetRenderOutput(resx,resy,1.333333,1.0,0,0,25);
}
main()
{
mem = new(Mem);
mem->p_x = 11;
mem->p_y = 8.5;
mem->dpi = 72;
RegisterMenuHook("DPI Conversion","Function");
}